﻿using ProtoBuf;

namespace Serialization
{
    /// <summary>
    /// This class is responsible for the serialization of achievments the current player has unlocked. An achievement has a name,
    /// an ID and a description.
    /// </summary>
    [ProtoContract]
    public class Achievement 
    {
        [ProtoMember(1)]
	    public int achievementID
	    {
		    get;
		    private set;
	    }
        [ProtoMember(2)]
	    public string name
	    {
		    get;
		    private set;
	    }
        [ProtoMember(3)]
        public string description
        {
            get;
            private set;
        }

	    public Achievement(string name, int ID, string description)
	    {
            this.name = name;
            this.achievementID = ID;
            this.description = description;
	    }

        //needed for protobuf
        private Achievement()
        {

        }

        public override bool Equals(object obj)
        {
            return this.ToString() == obj.ToString();
        }

        public override int GetHashCode()
        {
            return this.ToString().GetHashCode();
        }

        public override string ToString()
        {
            return name;
        }
    }
}

